import request from '@/utils/request'

// ==================== 申请审核相关API ====================

// 查询申请列表
export function listApplication(query) {
  return request({
    url: '/campus/application/list',
    method: 'get',
    params: query
  })
}

// 获取申请详细信息
export function getApplication(applicationId) {
  return request({
    url: '/campus/application/' + applicationId,
    method: 'get'
  })
}

// 审核申请
export function reviewApplication(data) {
  return request({
    url: '/campus/application/review',
    method: 'put',
    data: data
  })
}

// 批量审核申请
export function batchReviewApplications(data) {
  return request({
    url: '/campus/application/batchReview',
    method: 'put',
    data: data
  })
}

// 根据社团ID查询申请列表
export function getApplicationsByClub(clubId) {
  return request({
    url: '/campus/application/club/' + clubId,
    method: 'get'
  })
}

// 根据招聘ID查询申请列表
export function getApplicationsByRecruitment(recruitmentId) {
  return request({
    url: '/campus/application/recruitment/' + recruitmentId,
    method: 'get'
  })
}

// 获取申请统计信息
export function getApplicationStatistics(recruitmentId) {
  return request({
    url: '/campus/application/statistics/recruitment/' + recruitmentId,
    method: 'get'
  })
}

// 获取社团申请统计
export function getClubApplicationStatistics(clubId) {
  return request({
    url: '/campus/application/statistics/club/' + clubId,
    method: 'get'
  })
}

// 获取待审核申请数量
export function getPendingApplicationCount(clubId) {
  return request({
    url: '/campus/application/pendingCount/' + clubId,
    method: 'get'
  })
}

// 检查是否重复申请
export function checkDuplicateApplication(studentId, recruitmentId) {
  return request({
    url: '/campus/application/checkDuplicate',
    method: 'get',
    params: {
      studentId: studentId,
      recruitmentId: recruitmentId
    }
  })
}
